package com.xjm.ips.utils;

import com.xjm.ips.entity.Hr;
import org.springframework.security.core.context.SecurityContextHolder;

/**
 * 前端登陆后会把用户信息放在缓存中交由Security管理
 * 此工具类的功能即从Security中读取用户信息
 */
public class Hrutils {
    public static Hr getCurrentHr(){
        return ((Hr) SecurityContextHolder.getContext().getAuthentication().getPrincipal());
    }

    public static String getMydepPath(){
        return ((Hr) SecurityContextHolder.getContext().getAuthentication().getPrincipal()).getDepartment().getDepPath();
    }
}
